package com.kaka.mapper;

import com.kaka.pojo.Permission;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface PermissionMapper {

    @Select("select * from permission")
    List<Permission> selectAll();

    @Select("select * from permission where id=#{id}")
    Permission selectById(int id);

    @Update("update permission set permissionName=#{permissionName},url=#{url} where id=#{id}")
    int updatePermission(Permission permission);

    @Insert("insert into permission(permissionName,url) values(#{permissionName},#{url})")
    int addPermission(Permission permission);

    @Delete("delete from permission where id=#{id}")
    int deleteById(int id);

    List<Permission> selectByRid(int rid);

    List<Permission> selectByUid(int uid);
}
